package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

@Entity
public class Menu {
    private int meId;
    private String mePath;
    private String meName;
    private String meIcon;
    private Integer meisNot;
    private Integer meLevel;
    private List<Menu> meParentId;
    private String  identifier;
    private Permissionsset permissionssetByPsetId;


    @Id
    @Column(name = "Me_id")
    public int getMeId() {
        return meId;
    }

    public void setMeId(int meId) {
        this.meId = meId;
    }

    @Basic
    @Column(name = "Me_path")
    public String getMePath() {
        return mePath;
    }

    public void setMePath(String mePath) {
        this.mePath = mePath;
    }

    @Basic
    @Column(name = "Me_name")
    public String getMeName() {
        return meName;
    }

    public void setMeName(String meName) {
        this.meName = meName;
    }

    @Basic
    @Column(name = "Me_icon")
    public String getMeIcon() {
        return meIcon;
    }

    public void setMeIcon(String meIcon) {
        this.meIcon = meIcon;
    }


    @Basic
    @Column(name = "Meis_Not")
    public Integer getMeisNot() {
        return meisNot;
    }

    public void setMeisNot(Integer meisNot) {
        this.meisNot = meisNot;
    }

    @Basic
    @Column(name = "Me_level")
    public Integer getMeLevel() {
        return meLevel;
    }

    public void setMeLevel(Integer meLevel) {
        this.meLevel = meLevel;
    }


    @OneToMany
    public List<Menu> getMeParentId() {
        return meParentId;
    }

    public void setMeParentId(List<Menu> meParentId) {
        this.meParentId = meParentId;
    }

    @Basic
    @Column(name = "identifier")
    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Menu menu = (Menu) o;
        return meId == menu.meId &&
                Objects.equals(mePath, menu.mePath) &&
                Objects.equals(meName, menu.meName) &&
                Objects.equals(meIcon, menu.meIcon) &&
                Objects.equals(meisNot, menu.meisNot);
    }

    @Override
    public int hashCode() {
        return Objects.hash(meId, mePath, meName, meIcon, meisNot);
    }

    @ManyToOne
    @JoinColumn(name = "Pset_id", referencedColumnName = "Pset_id")
    public Permissionsset getPermissionssetByPsetId() {
        return permissionssetByPsetId;
    }

    public void setPermissionssetByPsetId(Permissionsset permissionssetByPsetId) {
        this.permissionssetByPsetId = permissionssetByPsetId;
    }

}
